﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace $rootnamespace$.admin.access
{
    public partial class Users : System.Web.UI.Page
    {
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (this.AlphaLinks1.Letter == "All")
            {
                this.GVUsers.DataSource = Membership.GetAllUsers();
            }
            else
            {
                this.GVUsers.DataSource = Membership.FindUsersByName(this.AlphaLinks1.Letter + "%");
            }
            this.GVUsers.DataBind();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MakeGridViewPrinterFriendly(this.GVUsers);
            }
        }

        private void MakeGridViewPrinterFriendly(GridView gridView)
        {
            if (gridView.Rows.Count > 0)
            {
                gridView.UseAccessibleHeader = true;
                gridView.HeaderRow.TableSection = TableRowSection.TableHeader;
            }
        }
    }
}